package com.chagee.store.operation.server.service.biz;

import com.alibaba.fastjson.JSONObject;
import com.chagee.base.utils.SoaResponse;
import com.chagee.base.utils.SoaUtil;
import com.chagee.personnel.api.event.service.emp.ChageeEmpReadApiService;
import com.chagee.storeManagement.api.event.bo.StoreBaseInfoBO;
import com.chagee.storeManagement.api.event.request.BaseRequest;
import com.chagee.storeManagement.api.event.service.IStoreInfoApi;
import com.chagee.storeManagement.api.event.service.StoreServiceApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author: yuanzhiqin
 * @date: 2024/7/2.
 */
@Service
@Slf4j
public class ThirdPartyService {

	@Resource
	private StoreServiceApi storeServiceApi;

	@Resource
	private ChageeEmpReadApiService chageeEmpReadApiService;

	@Resource
	private IStoreInfoApi storeInfoApi;

	public StoreBaseInfoBO queryStoreInfo(BaseRequest request){
		try {
			log.info("thirdPartyService#storeInfoApi.queryBaseInfo,request:{}", JSONObject.toJSONString(request));
			SoaResponse<StoreBaseInfoBO, Void> response = storeInfoApi.queryBaseInfo(request);
			StoreBaseInfoBO storeBaseInfoBO = SoaUtil.unpack(response);
			return storeBaseInfoBO;
		} catch (Exception e) {
			log.error("thirdPartyService#storeInfoApi.queryBaseInfo,request:{},error:{}", JSONObject.toJSONString(request),e);
			return null;
		}
	}
}
